package com.fit.entities.coach;

import java.util.LinkedList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.beaneditor.NonVisual;

import com.fit.entities.shedule.Shedule;
import com.fit.entities.training.Training;
import com.fit.entities.user.User;
import com.fit.model.UserRole;


@Entity
@Table(name="coach")
public class Coach {

	
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="coach_jmbg")
	private Long coachJMBG;
	
	
	
	 @Column(name="surname", nullable=false)
	 private String surname;
	
	
	 @Column(name="name", nullable=false)
	 private String name;
	
	@Column(name="age")
	private int age;
	
	@OneToOne(cascade = CascadeType.ALL,optional=false)
	@JoinColumn(name="user_id")
	private User user;
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.coach")
	private List<Training> trainings = new LinkedList<Training>();

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.coach")
	private List<Shedule> shedules = new LinkedList<Shedule>();
	
	@Property
	private Long userid;
	
	
	
	

	public Long getUserid() {
		return userid;
	}

	public void setUserid(Long userid) {
		this.userid = userid;
	}


	public Long getCoachJMBG() {
		return coachJMBG;
	}

	public void setCoachJMBG(Long coachJMBG) {
		this.coachJMBG = coachJMBG;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public List<Training> getTrainings() {
		return trainings;
	}

	public void setTrainings(List<Training> trainings) {
		this.trainings = trainings;
	}

	public List<Shedule> getShedules() {
		return shedules;
	}

	public void setShedules(List<Shedule> shedules) {
		this.shedules = shedules;
	}

	
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	


	
	
}
